//
//  UseCaseData.swift
//  SwiftUi
//
//  Created by xm on 05/09/2025.
//

import Foundation

struct UseCaseData {
    static var  persons:[Person] {
        let p1 = Person(id: 1, name: "演员1")
        let p2 = Person(id: 2, name: "演员2")
        let p3 = Person(id: 3, name: "演员3")
        
        return [p1, p2, p3]
    }
    
    static var movies:[Movie]{
    
        let m1 = Movie(id:1, name: "电影1", casts: persons)
        let m2 = Movie(id:2, name: "电影1", casts: persons)
        let m3 = Movie(id:3, name: "电影1", casts: persons)
        
        return [m1, m2, m3]
    }
    
    static var animes:[Anime]{
    
        let m1 = Anime(id:1, name: "动漫1")
        let m2 = Anime(id:2, name: "动漫2")
        let m3 = Anime(id:3, name: "动漫3")
        
        return [m1, m2, m3]
    }
    
    static func asyncGetMovies() async -> [Movie] {
        try? await Task.sleep(nanoseconds: 1_000_000_000) // 等待 1 秒
        return Self.movies
    }
    
    static func asyncGetAnimes() async -> [Anime] {
        try? await Task.sleep(nanoseconds: 1_000_000_000) // 等待 1 秒
        return Self.animes
    }
    
    
}
